const {defineConfig} = require('@vue/cli-service')

module.exports = defineConfig({
    transpileDependencies: true,
    lintOnSave: false,
    configureWebpack: {
        resolve: {
            alias: {
                '@': require('path').resolve(__dirname, 'src')
            }
        }
    },
    chainWebpack: (config) => {
        // 确保TypeScript配置正确
        config.resolve.extensions.add('.ts').add('.tsx')

        // 配置TypeScript加载器
        config.module
            .rule('ts')
            .test(/\.ts$/)
            .use('ts-loader')
            .loader('ts-loader')
            .options({
                appendTsSuffixTo: [/\.vue$/],
                transpileOnly: true
            })
            .end()
    }
})
